<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QXmlResultItems Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QXmlResultItems Class Reference<br /><sup><sup>[<a href="qtxmlpatterns.html">QtXmlPatterns</a> module]</sup></sup></h1><p>The QXmlResultItems class iterates through the results of evaluating an XQuery in <a href="qxmlquery.html">QXmlQuery</a>. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qxmlresultitems.html#QXmlResultItems">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />QXmlItem <b><a href="qxmlresultitems.html#current">current</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qxmlresultitems.html#hasError">hasError</a></b> (<i>self</i>)</li><li><div class="fn" />QXmlItem <b><a href="qxmlresultitems.html#next">next</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QXmlResultItems class iterates through the results of evaluating an XQuery in <a href="qxmlquery.html">QXmlQuery</a>.</p>
<p>QXmlResultItems presents the evaluation of an associated query as a sequence of <a href="qxmlitem.html">QXmlItems</a>. The sequence is traversed by repeatedly calling <a href="qxmlresultitems.html#next">next</a>(), which actually produces the sequence by lazy evaluation of the query.</p>
<pre> QXmlQuery query;
 query.setQuery("&lt;e/&gt;, 1, 'two'");
 QXmlResultItems result;

 if (query.isValid()) {
     query.evaluateTo(&amp;result);
     QXmlItem item(result.next());
     while (!item.isNull()) {
         <span class="comment">// use item</span>
         item = result.next();
     }
     if (result.hasError())
         <span class="comment">/* Runtime error! */</span>;
 }</pre>
<p>An effect of letting <a href="qxmlresultitems.html#next">next</a>() produce the sequence by lazy evaluation is that a query error can occur on any call to <a href="qxmlresultitems.html#next">next</a>(). If an error occurs, both <a href="qxmlresultitems.html#next">next</a>() and <a href="qxmlresultitems.html#current">current</a>() will return the null <a href="qxmlitem.html">QXmlItem</a>, and <a href="qxmlresultitems.html#hasError">hasError</a>() will return true.</p>
<p>QXmlResultItems can be thought of as an "iterator" that traverses the sequence of query results once, in the forward direction. Each call to <a href="qxmlresultitems.html#next">next</a>() advances the iterator to the next <a href="qxmlitem.html">QXmlItem</a> in the sequence and returns it, and <a href="qxmlresultitems.html#current">current</a>() always returns the <a href="qxmlitem.html">QXmlItem</a> that <a href="qxmlresultitems.html#next">next</a>() returned the last time it was called.</p>
<p>See also <a href="qxmlitem.html#isNode">QXmlItem.isNode</a>(), <a href="qxmlitem.html#isAtomicValue">QXmlItem.isAtomicValue</a>(), and <a href="qxmlnodemodelindex.html">QXmlNodeModelIndex</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QXmlResultItems" />QXmlResultItems.__init__ (<i>self</i>)</h3><p>Constructs an instance of <a href="qxmlresultitems.html">QXmlResultItems</a>.</p>
<a name="//apple_ref/cpp/instm/QXmlResultItems/~QXmlResultItems" />
<h3 class="fn"><a name="current" /><a href="qxmlitem.html">QXmlItem</a> QXmlResultItems.current (<i>self</i>)</h3><p>Returns the current item. The current item is the last item that was produced and returned by <a href="qxmlresultitems.html#next">next</a>().</p>
<p>Returns a null <a href="qxmlitem.html">QXmlItem</a> if there is no associated <a href="qxmlquery.html">QXmlQuery</a>.</p>
<a name="//apple_ref/cpp/instm/QXmlResultItems/hasError" />
<h3 class="fn"><a name="hasError" />bool QXmlResultItems.hasError (<i>self</i>)</h3><p>If an error occurred during evaluation of the query, true is returned.</p>
<p>Returns false if query evaluation has been done.</p>
<a name="//apple_ref/cpp/instm/QXmlResultItems/next" />
<h3 class="fn"><a name="next" /><a href="qxmlitem.html">QXmlItem</a> QXmlResultItems.next (<i>self</i>)</h3><p>Returns the next result in the sequence produced by lazy evaluation of the associated query. When the returned <a href="qxmlitem.html">QXmlItem</a> is null, either the evaluation terminated normally without producing another result, or an error occurred. Call <a href="qxmlresultitems.html#hasError">hasError</a>() to determine whether the null item was caused by normal termination or by an error.</p>
<p>Returns a null <a href="qxmlitem.html">QXmlItem</a> if there is no associated <a href="qxmlquery.html">QXmlQuery</a>.</p>
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.7.1-5014f7c72a58 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.1</td></tr></table></div></address></body></html>